import {
  logcheckSession
} from '../utils/util'
let userInfo = {
  avatarUrl: '',
  nickName: '请登录',
  phoneNumber: '',
  gender: 0,
};
const countsData = [{
    num: 2,
    name: '积分',
    type: 'point',
  },
  {
    num: 10,
    name: '优惠券',
    type: 'coupon',
  },
];

const orderTagInfos = [{
    orderNum: 1,
    tabType: 5,
  },
  {
    orderNum: 1,
    tabType: 10,
  },
  {
    orderNum: 1,
    tabType: 40,
  },
  {
    orderNum: 0,
    tabType: 0,
  },
];

const customerServiceInfo = {
  servicePhone: '4006336868',
  serviceTimeDuration: '每周三至周五 9:00-12:00  13:00-15:00',
};

//获取本地缓存
let userInfol = wx.getStorageSync('userInfo')
console.log(userInfol)
if (userInfol) {
  userInfo = {
    avatarUrl: userInfol.userInfo.avatarUrl,
    nickName: userInfol.userInfo.nickName,
    phoneNumber: '',
    gender: userInfol.userInfo.gender,
  }
  // logcheckSession();
} else {
  // console.log('lllllll');
  // wx.navigateTo({
  //   url: '/pages/usercenter/userAuthorized/Authorized'
  // });
}



export const genSimpleUserInfo = () => ({
  ...userInfo
});

export const genUsercenter = () => ({
  userInfo,
  countsData,
  orderTagInfos,
  customerServiceInfo,
});